package aigcAdminUtils

import "gorm.io/gorm"

// GlobalVariableName 是全局变量名称
type GlobalVariableName string

const (
	GlobalVariableVersion    GlobalVariableName = "version"    //版本号
	GlobalVariableUploadPath GlobalVariableName = "uploadPath" //上传路径
)

// 获取全局变量的值
func GetGlobalVariable(db *gorm.DB, name GlobalVariableName) (string, error) {
	var data GlobalVariable
	err := db.Where("id = ?", name).First(&data).Error
	if err != nil {
		return "", err
	}
	return data.Value, nil
}
